package com.example.mingyue.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * rabbitmq初始化交换机、消息队列
 */
@Configuration
public class ExchangeConfig {

    @Bean
    public FanoutExchange fanoutExchange(){

        return new FanoutExchange("mingyue.jiaohuan");
    }
    @Bean
    public Queue fanoutQueue1(){

        return new Queue("mingyue.queue1");
    }
    @Bean
    public Binding bindingBuilder(Queue queue1,FanoutExchange fanoutExchange){

        return BindingBuilder.bind(fanoutQueue1()).to(fanoutExchange());
    }


}
